using Core.IocHelpers;
using NHibernate;

namespace Core.Interfaces
{
  ///<summary>Get the NHibernate session provider</summary>
  [AutoRegisterable]
  public interface ISessionProvider
  {
    /// <summary>Get a current NHibernate session</summary>
    ISession GetSession(bool recreateFreshSession);

    /// <summary>Prepare NHibernate. Optional, to speed up first call to GetSession()</summary>
    void PrepareSessionFactory();

    /// <summary>Prepare NHibernate.</summary>
    /// <param name="createDbFile">If true, will backup existing db and make a new one</param>
    void PrepareSessionFactory(bool createDbFile);

    ///<summary>Recreates the current session</summary>
    ///<returns></returns>
    ISession GetFreshSession();

    ///<summary></summary>
    ///<returns></returns>
    ISession GetSession();
  }
}